# coding=UTF-8
from flask import Flask
from flask import request
from Wechat import *

app = Flask(__name__)
#app.config.from_object('Config.Config')
#app.run(host='0.0.0.0',port=5555,debug=True)

@app.route('/', methods=['GET', 'POST'])
def home():
    return '<h1>Home</h1>'

@app.route('/send', methods=['GET','POST'])
def send():
    key = request.values.get('key',0)
    msg = request.values.get('msg', 0)
    send_msg_by_group(key,msg)
    return '<h1>发送成功</h1>'+key+msg

def application(environ, start_response):
    start_response('200 OK', [('Content-Type', 'text/html')])
    body = '<h1>Hello, %s!</h1>' % (environ['PATH_INFO'][1:] or 'web')
    return [body.encode('utf-8')]

if __name__ == '__main__':
    app.run()